package com.liran.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liran.entity.VipInfoEntity;
import com.liran.param.VipInfoListParam;
import com.liran.service.VipInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author whh
 * @since 2022-07-10
 */
@RestController
@RequestMapping("/sys/vip")
@AllArgsConstructor
@Api("vip信息管理控制层")
public class VipInfoController {

    private final VipInfoService vipInfoService;

    @ApiOperation("分页查询")
    @PostMapping("/list")
    public Page<VipInfoEntity> list(@RequestBody VipInfoListParam vipInfoListParam) {
        return vipInfoService.listSearch(vipInfoListParam);
    }

    @PostMapping("/operate")
    public Boolean add(@RequestBody VipInfoEntity vipInfoEntity) {
        return vipInfoService.saveOrUpdate(vipInfoEntity);
    }

    @GetMapping("/del/{id}")
    public Boolean del(@PathVariable Long id) {
        return vipInfoService.removeById(id);
    }

    @GetMapping("/get")
    public List<VipInfoEntity> get() {
        return vipInfoService.list();
    }

}

